﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics.Contracts;
using YasharEl.Infrastructure.Caching.Orm;
using YasharEl.Infrastructure.Caching.Expirations;

namespace YasharEl.Infrastructure.Caching
{
    public class DisabledCacheManager : ICacheManager, IOrmCacheManager
    {
        #region Constructors

        public DisabledCacheManager(string name)
        {
            Contract.Requires<ArgumentNullException>(!string.IsNullOrEmpty(name), "name could not be null or empty.");
            Name = name;
        }

        #endregion

        #region ICacheManager Implementations

        public void Add(string key, object value)
        {

        }

        public void Add(string key, object value, CacheItemPriority scavengingPriority, ICacheItemRefreshAction refreshAction, params ICacheItemExpiration[] expirations)
        {

        }

        public bool Contains(string key)
        {
            return false;
        }

        public int Count
        {
            get { return 0; }
        }

        public void Flush()
        {
        }

        public object GetData(string key)
        {
            return null;
        }

        public void Remove(string key)
        {

        }

        public object this[string key]
        {
            get { return null; }
        }

        public ISerializationProvider SerializationProvider
        {
            get { return null; }
        }

        public string Name
        {
            get;
            private set;
        }

        #endregion

        #region IOrmCacheManager Implementations

        public void Lock(string key)
        {
        }

        public void Unlock(string key)
        {
        }

        public void Destroy()
        {
        }

        public int LockTimeout
        {
            get { return 10000; }
        }

        #endregion
    }
}
